<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
     <style>
         *{
             margin: 0;
             padding: 0;
         }
         img{
             position: relative;
             width: 250px;
             height: 250px;
         }
     </style>
</head>
<body>
    <img src="img/2.jpg" alt="">
</body>
<script>
    var img = document.querySelector('img')
    console.log(img.offsetLeft);
    var timer = setInterval(function(){
        if(img.offsetLeft === 600){ 
            clearInterval(timer)
        }
        img.style.left = img.offsetLeft + 1 + 'px'
    },5)
</script>
</html>